var rawType = $('base').attr('rawType');

(function(){

    refreshErTable();

    var currentData;
    $(document).on('click','button',function(e){
        e.stopPropagation();
        if ($(this).attr('id') == 'btn-undo'){
            commandManager.undo();
        }else if ($(this).attr('id') == 'btn-redo'){
            commandManager.redo();
        }else if ($(this).attr('id') == 'btn-print'){
            paper.print();
        }else if ($(this).attr('id') == 'btn-clear'){
            graph.clear();
        }else if ($(this).attr('id') == 'btn-png'){
            paper.openAsPNG();
        }else if ($(this).attr('id') == 'btn-svg'){
            paper.openAsSVG();
        }else if ($(this).attr('id') == 'btn-search'){

            if(currentData == undefined){
                layer.open({
                    title: '提示',
                    content: '还没有加载对象',
                    shade: 0
                });
            }else {
                layer.open({
                    type:2,
                    content:['searchTable2.html'],
                    title:'搜索类型',
                    area:['600px','450px']
                })
            }
        }else if ($(this).attr('id') == 'btn-refresh'){
            refreshErTable();
        }else if ($(this).attr('id') == 'btn-layout'){
            $.ajax({
                url : requestUrl+'/rest/webpage/render/fullPosition',
                type: 'POST',
                dataType: 'JSON',
                data : {"dsId":dsId,"modelId":modelId, "rawType":rawType},
                success: function (data) {
                    $.each(data.object.dataObjects,function(i,v){
                        var cell = graph.getCell(v.objectId);

                        cell.position(v.positionVo.positionX,v.positionVo.positionY)  //移动元素的位置
                    })

                },
                error : function(data){
                    console.log(data)
                }
            })
        }
    });

    function len(s) {
        var l = 0;
        var a = s.split("");
        for (var i=0;i<a.length;i++) {
            if (a[i].charCodeAt(0)<299) {
                l++;
            } else {
                l+=2;
            }
        }
        return l;
    }


    function refreshErTable(){
        var lodingShade;
        $.ajax({
            url : '/rest/combing/findr/relationDiagram',
            type: 'POST',
            dataType: 'JSON',
            data : {"relationId":relationId,"subTableId":subTableId},
            beforeSend: function () {
                 lodingShade = '<div class="lodingShade" style="position:absolute;top:0;left:0;bottom:0;right:0;background: rgba(0,0,0,.3); z-index: 10;"><div style="position:fixed;left:50%;top:50%;transform: translate(-50%,-50%);padding:12px 25px;background:#fff;border-radius: 3px;"><i class="layui-icon layui-icon-loading layui-icon layui-anim layui-anim-rotate layui-anim-loop" style="font-size: 24px;vertical-align: sub;"></i><span style="margin-left:5px;">正在加载中，请耐心等候...</span></div></div>';
                $(document.body).append(lodingShade);
            },
            success: function (data) {
                window.data = currentData = data;

                var data_list = {'cells': []}; //渲染元素的对象

                var startTime =new Date().getTime();
                $.each(data.object.dataObjects, function (i, v) {

                    var this_v = v;  //记录当前表对象
                    var objectChname = this_v.objectChname ? this_v.objectChname : this_v.tableName; //表中文名
                    var tableName = this_v.tableName?this_v.tableName:this_v.objectChname; //表英文名

                    var obj =   {
                        "type": "bpmn.Choreography",
                        "participants": [
                            objectChname
                        ],
                        "initiatingParticipant": "Potential Buyer",
                        "position": {
                            "x": this_v.positionVo.positionX,
                            "y": this_v.positionVo.positionY
                        },
                        "angle": 0,
                        "id": this_v.objectId,
                        "embeds": "",
                        "z": 1,
                        "qTableName" : this_v.qTableName,
                        "subProcess": false,
                        "attrs": {
                            ".participant-rect": {
                                "fill": "ff8040"
                            },
                            '.participant-label':{
                                'fill': '#fff'
                            },
                            ".sub-process": {
                                "visibility": "hidden",
                                "data-sub-process": ""
                            },
                            'div': {

                            },
                            '.body' : {

                            },
                            'objectChname': objectChname,
                            'tableName': tableName,
                            'isEnglish': false
                        }
                    };

                    var MaxChart;
                    var maxShowNameCharSize = 0;
                    var maxDataTypeCharSize = 0;
                    var maxFeatureCharSize = 0;

                    var fieldsArr = [];
                    $.each(this_v.columns, function (i, v) {   //遍历字段信息
                        var columnShowname =  v.columnChname ? v.columnChname: v.columnName;
                        var columnNameEnglish = v.columnName?v.columnName:v.columnChname;
                        var columnDataTypeFullText = v.dataTypeFullText;
                        var columnFeature = "[";
                        if (v.pk){
                            columnFeature = columnFeature + "PK,";
                        }
                        if (v.fk){
                            columnFeature = columnFeature + "FK,";
                        }
                        if (v.nk){
                            columnFeature = columnFeature + "NK,";
                        }

                        if (columnFeature.charAt(columnFeature.length-1) == ','){
                            columnFeature = columnFeature.substring(0, columnFeature.length -1) + "]";
                        }
                        else {
                            columnFeature = "";
                        }

                        var showNameCharSize = len(columnShowname) *7;
                        var dataTypeCharSize = len(columnDataTypeFullText) *7;
                        var featureCharSize = len(columnFeature) *7;

                        if (showNameCharSize > maxShowNameCharSize)  maxShowNameCharSize = showNameCharSize;
                        if (dataTypeCharSize > maxDataTypeCharSize)  maxDataTypeCharSize = dataTypeCharSize;
                        if (featureCharSize > maxFeatureCharSize)  maxFeatureCharSize = featureCharSize;



                        var pfields = '<tr><td class="fieldsTd columnName" data-columnName="' + columnNameEnglish + '" data-columnChname="' +columnShowname+ '">' + columnShowname + '</td><td class="fieldsTd">'+columnDataTypeFullText+'</td><td class="fieldsTd">'+columnFeature+'</td></tr>';
                        fieldsArr.push(pfields);   //每行添加到元素中
                    })

                    MaxChart = maxShowNameCharSize + maxDataTypeCharSize + maxFeatureCharSize;

                    obj.attrs.div.html =  '<table>'+fieldsArr.join("")+'</table>';  //字段信息全部加载到元素中
                    obj.size = {  //元素的大小
                        "width": ((this_v.positionVo.positionWidth && rawType !='fm') ? this_v.positionVo.positionWidth : MaxChart + 100),
                        "height": ((this_v.positionVo.positionHeight && rawType !='fm') ? this_v.positionVo.positionHeight : (30 + (this_v.columns.length>5?5:this_v.columns.length) * 25))
                    }; //字段宽度的最大值


                    data_list.cells.push(obj);      //所有的表对象添加

                });

                var time1 =new Date().getTime();
                console.log("复制表对象耗时:" +  (time1 - startTime));

                $.each(data.object.fks, function (i, v) {  //遍历线
                    var link = {
                        "type":"link",
                        "source":{"id":v.objectId},
                        "target":{"id":v.refedObjectId},
                        //  "router":{"name":"manhattan"},
                        "connector":{"name":"rounded"},
                        "id":v.fkId,
                        "z":7,
                        "vertices":[],
                        "attrs":{".connection":{/*"stroke":"#20C1DD"*/,"stroke-width":2,/*"stroke-dasharray":(v.isPhy?null:"5 2"),*/"pointerEvents":"none"},
                            ".marker-target":{/*"fill":"#20C1DD","stroke":"#20C1DD",*/"d":"M 10 0 L 0 5 L 10 10 z"}}
                        ,
                        "labels": [
                            {"position": 0.5, "attrs": {"text": {"text": v.fkChname ? v.fkChname : v.phyFkName}}}
                        ],
                        '.tool-remove' : v.isPhy?null:''
                    };
                    
                    if(v.type ==="discovery"){
                        link.attrs[".connection"].stroke = "#20C1DD";
                        link.attrs[".marker-target"].fill = "#20C1DD";
                        link.attrs[".marker-target"]["stroke-dasharray"] = "5 2";
                        
                        link.attrs[".connection"].stroke = "#20C1DD";
                    }else{
                        link.attrs[".connection"].stroke = "#feb663";
                        link.attrs[".marker-target"].fill = "#feb663";
                        link.attrs[".marker-target"].stroke = "#feb663";
                    }
                    
                    data_list.cells.push(link); //所有的关系对象添加
                });

                var time2 =new Date().getTime();
                console.log("复制连线对象耗时:" +  (time2 - time1));

                graph.fromJSON(data_list);   //导入json数据

                $(".lodingShade").remove();

                var endTime =new Date().getTime();
                console.log("渲染ER图耗时:" +  (endTime - time2));
                console.log("加载ER图总耗时:" +  (endTime - startTime));

            },
            error: function (data) {

                $(".lodingShade").remove();
                layer.open({
                    title: '提示',
                    content: '网络异常',
                    shade: 0
                });
            }
        })
    }

   /* function refreshErTable() {

        var data = {
            "code" : 0,
            "msg" : "成功",
            "data" : [ ],
            "object" : {
                "dataObjects" : [ {
                    "objectId" : "37d8a09a-dbc1-4123-9fc4-e6838a0e6ef9",
                    "tableName" : "d2w_sys_log",
                    "qTableName" : "hmcs_1.d2w_sys_log",
                    "objectChname" : "日志表",
                    "objectType" : "tb",
                    "remark" : null,
                    "isPhy" : true,
                    "columns" : [ {
                        "columnId" : "7b5b1afa-21af-4f92-be99-956b65f12110",
                        "columnName" : "ID",
                        "columnChname" : "标识",
                        "objectId" : "37d8a09a-dbc1-4123-9fc4-e6838a0e6ef9",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(50)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "a87bb6e8-95b6-4ffd-a083-2f6b4aa0b558",
                        "columnName" : "USER_ID",
                        "columnChname" : "用户id",
                        "objectId" : "37d8a09a-dbc1-4123-9fc4-e6838a0e6ef9",
                        "logicDataType" : "1",
                        "dataTypeFullText" : "DECIMAL(8)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "9df9d53b-f616-4f66-817d-68823341e2fd",
                        "columnName" : "USERNAME",
                        "columnChname" : "用户名",
                        "objectId" : "37d8a09a-dbc1-4123-9fc4-e6838a0e6ef9",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(50)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "4e343db2-8d71-41c6-94b0-26f3b2dfdb67",
                        "columnName" : "OPERATION",
                        "columnChname" : "用户操作",
                        "objectId" : "37d8a09a-dbc1-4123-9fc4-e6838a0e6ef9",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(50)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "4632de02-24a5-4746-a3a7-f74eb2db08f1",
                        "columnName" : "TIME",
                        "columnChname" : "响应时间",
                        "objectId" : "37d8a09a-dbc1-4123-9fc4-e6838a0e6ef9",
                        "logicDataType" : "1",
                        "dataTypeFullText" : "DECIMAL(8)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "ff221f36-e3d4-4d1f-8f08-87271a169064",
                        "columnName" : "METHOD",
                        "columnChname" : "请求方法",
                        "objectId" : "37d8a09a-dbc1-4123-9fc4-e6838a0e6ef9",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(200)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "9817fc64-d58a-41b2-ad83-02fae0205908",
                        "columnName" : "PARAMS",
                        "columnChname" : "请求参数",
                        "objectId" : "37d8a09a-dbc1-4123-9fc4-e6838a0e6ef9",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(2000)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "ce104dc2-0e02-47c6-99ba-cf484f1edf8a",
                        "columnName" : "IP",
                        "columnChname" : "IP地址",
                        "objectId" : "37d8a09a-dbc1-4123-9fc4-e6838a0e6ef9",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(64)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "b3b74700-1461-4e39-9028-78fe0683d761",
                        "columnName" : "GMT_CREATE",
                        "columnChname" : "创建时间",
                        "objectId" : "37d8a09a-dbc1-4123-9fc4-e6838a0e6ef9",
                        "logicDataType" : "9",
                        "dataTypeFullText" : "DATETIME(19)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    } ],
                    "positionVo" : {
                        "objectId" : "37d8a09a-dbc1-4123-9fc4-e6838a0e6ef9",
                        "positionX" : 0,
                        "positionY" : 350,
                        "positionWidth" : 0,
                        "positionHeight" : 0,
                        "modelId" : null
                    },
                    "pkIndexId" : null
                }, {
                    "objectId" : "6a9f999d-2ffd-4113-a914-3c3e4f4ec55a",
                    "tableName" : "d2w_di_dx_biztype",
                    "qTableName" : "hmcs_1.d2w_di_dx_biztype",
                    "objectChname" : "交换流程业务类别",
                    "objectType" : "tb",
                    "remark" : null,
                    "isPhy" : true,
                    "columns" : [ {
                        "columnId" : "006bd530-d5ba-4ca5-86e1-12a95f9f4b6b",
                        "columnName" : "DX_BIZTYPE_ID",
                        "columnChname" : "DX_BIZTYPE_I",
                        "objectId" : "6a9f999d-2ffd-4113-a914-3c3e4f4ec55a",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(30)",
                        "value" : null,
                        "pk" : true,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "0d27d81c-a4fc-4b9d-944b-e5828e7d51a8",
                        "columnName" : "DX_BIZTYPE_NAME",
                        "columnChname" : "流程业务类别名称",
                        "objectId" : "6a9f999d-2ffd-4113-a914-3c3e4f4ec55a",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(127)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "326e2ec1-075b-46d1-b2e4-8a5f1fdd3697",
                        "columnName" : "SORT_SN",
                        "columnChname" : "排序号",
                        "objectId" : "6a9f999d-2ffd-4113-a914-3c3e4f4ec55a",
                        "logicDataType" : "5",
                        "dataTypeFullText" : "INT(10)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    } ],
                    "positionVo" : {
                        "objectId" : "6a9f999d-2ffd-4113-a914-3c3e4f4ec55a",
                        "positionX" : 354,
                        "positionY" : 350,
                        "positionWidth" : 0,
                        "positionHeight" : 0,
                        "modelId" : null
                    },
                    "pkIndexId" : "3c1e0312-aff6-4a5a-bac6-86dbe62246e3"
                }, {
                    "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                    "tableName" : "d2w_di_dxflow",
                    "qTableName" : "hmcs_1.d2w_di_dxflow",
                    "objectChname" : "交换流程",
                    "objectType" : "tb",
                    "remark" : null,
                    "isPhy" : true,
                    "columns" : [ {
                        "columnId" : "07e510f1-fc8e-440e-8d4c-162299f35c5c",
                        "columnName" : "DXFLOW_ID",
                        "columnChname" : "流程ID",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : true,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "3333b66a-9f53-40b7-bfe5-eec51a5ce611",
                        "columnName" : "DXFLOW_NAME",
                        "columnChname" : "流程名称",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(127)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "bd979281-8bcf-4284-8d38-5757a616c404",
                        "columnName" : "DX_BIZTYPE_ID",
                        "columnChname" : "流程业务类型",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(30)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "cb48b108-6d78-4477-8fa9-77f294eeb21d",
                        "columnName" : "DXFLOW_TECHTYPE",
                        "columnChname" : "流程技术类型:COPY-",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(60)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "c2c9fcb8-ac43-42e1-989d-de85b1f3cf83",
                        "columnName" : "PROCESS_MAINTAIN_WAY",
                        "columnChname" : "流程维护方式，0-管控中",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "2263fd54-1ce0-4940-9f44-e02f859d4595",
                        "columnName" : "INPUT_STEP_ID",
                        "columnChname" : "输入步骤ID",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "61bb0f05-447f-4c57-b945-f00150325ac9",
                        "columnName" : "OUTPUT_STEP_ID",
                        "columnChname" : "输出步骤ID",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "68c15deb-02a3-49fe-a691-e4f78bb06f97",
                        "columnName" : "IS_REBUILD_ETLFLOW",
                        "columnChname" : "是否需要重新生成流程",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "4d7a71ac-06a4-4797-a080-f447f1b387a3",
                        "columnName" : "IS_NEED_INIT",
                        "columnChname" : "是否需要初始化",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "f616770e-91ff-4c9d-982c-213c397982e9",
                        "columnName" : "STATUS",
                        "columnChname" : "状态:0-作废,1-启用",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "af40ff88-55a2-414f-bf81-6ba78dcff17e",
                        "columnName" : "FINISHED_MAX_INC_VAL",
                        "columnChname" : "增量字段最大值",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(64)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "37e091dc-fa6b-435b-affe-94ebf95a83a0",
                        "columnName" : "LAST_EXECLOG_ID",
                        "columnChname" : "最后执行日志ID",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "4c4535e9-ee67-4752-b010-d8ae59565131",
                        "columnName" : "TENANT_ID",
                        "columnChname" : "所属租户",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "38a6cce0-ad97-4af0-a18c-50620f9b90f4",
                        "columnName" : "CREATOR",
                        "columnChname" : "创建者",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "713a5ef0-ac92-44f0-afc5-b86523e03f2e",
                        "columnName" : "CREATE_TIME",
                        "columnChname" : "创建时间",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "9",
                        "dataTypeFullText" : "DATETIME(19)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "5ffa7ea6-ddeb-4158-ad72-4e4dc63de451",
                        "columnName" : "MODIFIER",
                        "columnChname" : "最后修改者",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "0a1ed40b-80f8-4ba9-bf3d-7e03eb952116",
                        "columnName" : "MODIFY_TIME",
                        "columnChname" : "最后修改时间",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "9",
                        "dataTypeFullText" : "DATETIME(19)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "240d00d8-0414-4462-99bb-dbed1cfda841",
                        "columnName" : "NODE_ID",
                        "columnChname" : "节点ID",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "1f9ea108-c98f-4c6f-b06b-a7858f5c6de3",
                        "columnName" : "EXTRACT_OR_RECEIVE",
                        "columnChname" : "数据获取方式是抽取，还是",
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(8)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    } ],
                    "positionVo" : {
                        "objectId" : "05143b69-e296-449e-8bd1-44e6ae137dd3",
                        "positionX" : 0,
                        "positionY" : 704,
                        "positionWidth" : 0,
                        "positionHeight" : 0,
                        "modelId" : null
                    },
                    "pkIndexId" : "c46096bd-4abf-4fbd-8c8d-ed35974818cd"
                }, {
                    "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                    "tableName" : "d2w_res_dataobj_fk",
                    "qTableName" : "hmcs_1.d2w_res_dataobj_fk",
                    "objectChname" : "数据对象外键关系",
                    "objectType" : "tb",
                    "remark" : null,
                    "isPhy" : true,
                    "columns" : [ {
                        "columnId" : "e56aedd1-abb6-40a7-aa60-163c2af3f67e",
                        "columnName" : "FK_ID",
                        "columnChname" : "外键关系ID",
                        "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : true,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "794494c1-fcf6-4a8a-aef0-e96a21b98ffd",
                        "columnName" : "PHY_FK_NAME",
                        "columnChname" : "物理数据库外键名",
                        "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(127)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "5665a897-2155-467a-9885-2eb97b615f3c",
                        "columnName" : "FK_CHNAME",
                        "columnChname" : "外键关系中文名",
                        "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(127)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "5f27d992-cf41-4cef-afef-ea63829f54a6",
                        "columnName" : "OBJECT_ID",
                        "columnChname" : "数据对象ID",
                        "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "aa01d3da-5a96-44b5-85f0-72ce5dbf7fd8",
                        "columnName" : "REFED_OBJECT_ID",
                        "columnChname" : "被引用数据对象ID",
                        "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : true
                    }, {
                        "columnId" : "5f0ae449-9778-47ed-9baa-f61b5a2d4387",
                        "columnName" : "REFED_OBJECT_QNAME",
                        "columnChname" : "被引用数据对象限定名",
                        "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(127)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "2c68a58a-63df-4d51-a7b2-b1eef072eb6e",
                        "columnName" : "IS_PHY",
                        "columnChname" : "是否为物理的",
                        "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "5bde95cc-522d-4dd3-a46d-ae221557be8b",
                        "columnName" : "REF_UPDATE_METHOD",
                        "columnChname" : "外键数据更新策略",
                        "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                        "logicDataType" : "5",
                        "dataTypeFullText" : "INT(10)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "6660541f-0a03-485c-b811-abb9cd08d46a",
                        "columnName" : "REF_DELETE_METHOD",
                        "columnChname" : "外键数据删除级联原则",
                        "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                        "logicDataType" : "5",
                        "dataTypeFullText" : "INT(10)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "4bc561fb-5152-4925-924e-4e3a5a7897c1",
                        "columnName" : "IS_ENABLE",
                        "columnChname" : "是否启用,数据库里是否启",
                        "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    } ],
                    "positionVo" : {
                        "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                        "positionX" : 0,
                        "positionY" : 1466,
                        "positionWidth" : 0,
                        "positionHeight" : 0,
                        "modelId" : null
                    },
                    "pkIndexId" : "60b60de5-553a-489f-829c-bfd61f2ddb0e"
                }, {
                    "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                    "tableName" : "d2w_res_dataobj",
                    "qTableName" : "hmcs_1.d2w_res_dataobj",
                    "objectChname" : "数据对象",
                    "objectType" : "tb",
                    "remark" : null,
                    "isPhy" : true,
                    "columns" : [ {
                        "columnId" : "bdc9667d-55c1-4bdb-b421-b21cbb63ed53",
                        "columnName" : "OBJECT_ID",
                        "columnChname" : "数据对象ID",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : true,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "afb0f214-6424-4ee7-9272-6cb14f6339b0",
                        "columnName" : "DS_ID",
                        "columnChname" : "数据源ID",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : true
                    }, {
                        "columnId" : "a394e5d6-53cc-44b2-8dfa-b0b067f475c3",
                        "columnName" : "TABLE_NAME",
                        "columnChname" : "数据表名",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(255)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "f1c2f07b-93a2-40f4-9b2c-8dd9408d846c",
                        "columnName" : "Q_TABLE_NAME",
                        "columnChname" : "限定名",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(255)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "e86cb790-5e8f-4b1f-8b7e-c0fa89bc38b1",
                        "columnName" : "SCHEMA_NAME",
                        "columnChname" : "模式(库)名",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(127)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "dbbac758-f846-439e-ae7a-a41835d4ed82",
                        "columnName" : "OBJECT_CHNAME",
                        "columnChname" : "数据对象中文名",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(255)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "deae7117-7e5e-4b3c-bb88-c08ce512e62d",
                        "columnName" : "PK_INDEX_ID",
                        "columnChname" : "主键索引ID",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "4676f428-dbda-47a1-9b91-bab512c0baf8",
                        "columnName" : "OBJECT_TYPE",
                        "columnChname" : "数据对象类型编码",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(30)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : true
                    }, {
                        "columnId" : "70cf2a9a-6046-4472-8838-ffd81a9c576c",
                        "columnName" : "IS_STRUCT_DATA",
                        "columnChname" : "是否为结构化数据",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "5fd9ec0a-cc74-4552-a617-f2ebd81b4d7d",
                        "columnName" : "EXECUTE_SQL",
                        "columnChname" : "数据对象SQL",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "TEXT(65535)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "03ba51c9-8480-4650-9bbe-a3d3330378d9",
                        "columnName" : "REMARK",
                        "columnChname" : "注释",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(1023)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "f5f8d43f-e66b-4256-b77b-a400a2e3aec7",
                        "columnName" : "IS_ALLOW_WRITE",
                        "columnChname" : "是否允许写操作对象",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "82606e19-9b59-4398-9f5c-e7ae9f3c0271",
                        "columnName" : "IS_PHY",
                        "columnChname" : "是否为物理存在的对象",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "da8f66c9-835c-473d-9c52-1cf5eb391052",
                        "columnName" : "STATUS",
                        "columnChname" : "状态(0-未登记为数据对",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "f32720f6-4e39-46f7-8415-12d2a8c9dfa8",
                        "columnName" : "ROW_SIZE",
                        "columnChname" : "记录条数",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "1",
                        "dataTypeFullText" : "DECIMAL(12)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "cec5020d-a9b2-42b7-97e6-e1c222d0504b",
                        "columnName" : "STATISTIC_TIME",
                        "columnChname" : "统计时间",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "9",
                        "dataTypeFullText" : "DATETIME(19)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "14d7d3af-abaa-4983-bc3b-98dd0f6389f9",
                        "columnName" : "INC_U_COLUMN_ID",
                        "columnChname" : "数据变更时间戳字段",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "e0498513-10db-4ad1-a4ba-2dd7dde3e572",
                        "columnName" : "INC_I_COLUMN_ID",
                        "columnChname" : "数据创建时间戳字段",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "2e314308-b5f4-4e51-abff-24c2b1df4bde",
                        "columnName" : "CREATOR",
                        "columnChname" : "创建者",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "47d16417-e362-402c-9312-3b871d40b1a6",
                        "columnName" : "CREATE_TIME",
                        "columnChname" : "创建时间",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "9",
                        "dataTypeFullText" : "DATETIME(19)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "8d0c34fd-7ea6-4a65-8f10-b2fb96320ff9",
                        "columnName" : "MODIFIER",
                        "columnChname" : "最后修改者",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "d0235066-289d-4d56-b34d-56b3f2fccfc7",
                        "columnName" : "MODIFY_TIME",
                        "columnChname" : "最后修改时间",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "9",
                        "dataTypeFullText" : "DATETIME(19)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "8786a850-cab6-44ee-9384-026d191438d7",
                        "columnName" : "ORG_ID",
                        "columnChname" : "所属机构",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "2bd37cb5-a519-4b13-af46-030bc9f090e6",
                        "columnName" : "MIRROR_OBJECT_ID",
                        "columnChname" : "镜像的数据对象ID",
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    } ],
                    "positionVo" : {
                        "objectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                        "positionX" : 0,
                        "positionY" : 1262,
                        "positionWidth" : 0,
                        "positionHeight" : 0,
                        "modelId" : null
                    },
                    "pkIndexId" : "d63ed4ae-b541-4ad6-a0b7-e82c628401fd"
                }, {
                    "objectId" : "a23ea543-17d8-40c0-9d33-03d643f38200",
                    "tableName" : "d2w_ts_task_log",
                    "qTableName" : "hmcs_1.d2w_ts_task_log",
                    "objectChname" : "调度启动记录",
                    "objectType" : "tb",
                    "remark" : null,
                    "isPhy" : true,
                    "columns" : [ {
                        "columnId" : "c8d53680-165b-4985-84db-6c2a2c1144a7",
                        "columnName" : "TU_EXCUTE_ID",
                        "columnChname" : "调度执行批次ID",
                        "objectId" : "a23ea543-17d8-40c0-9d33-03d643f38200",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : true,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "96c0cf99-606d-42d1-9c22-f531f76a38f4",
                        "columnName" : "TU_ID",
                        "columnChname" : "任务单元ID",
                        "objectId" : "a23ea543-17d8-40c0-9d33-03d643f38200",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "671bc573-3c8e-4f64-897a-bfc773687ea6",
                        "columnName" : "START_TIME",
                        "columnChname" : "启动时间",
                        "objectId" : "a23ea543-17d8-40c0-9d33-03d643f38200",
                        "logicDataType" : "9",
                        "dataTypeFullText" : "DATETIME(19)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "913582f1-7c9e-4946-b5a3-908c26966249",
                        "columnName" : "START_STEP_ID",
                        "columnChname" : "启动步骤ID",
                        "objectId" : "a23ea543-17d8-40c0-9d33-03d643f38200",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "7f926b1f-3cba-491b-9142-c39ca89d02f7",
                        "columnName" : "IS_FINISHED",
                        "columnChname" : "是否结束",
                        "objectId" : "a23ea543-17d8-40c0-9d33-03d643f38200",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "52c28a03-2de5-4518-90f3-67d01dda6dfa",
                        "columnName" : "END_TIME",
                        "columnChname" : "结束时间",
                        "objectId" : "a23ea543-17d8-40c0-9d33-03d643f38200",
                        "logicDataType" : "9",
                        "dataTypeFullText" : "DATETIME(19)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "18141736-892a-427f-a851-dc3575614952",
                        "columnName" : "EXPECT_STEP_NUM",
                        "columnChname" : "预期启动步骤个数",
                        "objectId" : "a23ea543-17d8-40c0-9d33-03d643f38200",
                        "logicDataType" : "5",
                        "dataTypeFullText" : "INT(10)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "35ae7015-84d0-49af-bbfb-e4d492756b7c",
                        "columnName" : "FINISHED_STEP_NUM",
                        "columnChname" : "实际结束步骤个数",
                        "objectId" : "a23ea543-17d8-40c0-9d33-03d643f38200",
                        "logicDataType" : "5",
                        "dataTypeFullText" : "INT(10)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "a3c33855-2e51-4441-a065-a6a5bd7f298d",
                        "columnName" : "PARENT_TU_EXCUTE_ID",
                        "columnChname" : "父任务单元启动批次",
                        "objectId" : "a23ea543-17d8-40c0-9d33-03d643f38200",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    } ],
                    "positionVo" : {
                        "objectId" : "a23ea543-17d8-40c0-9d33-03d643f38200",
                        "positionX" : 354,
                        "positionY" : 704,
                        "positionWidth" : 0,
                        "positionHeight" : 0,
                        "modelId" : null
                    },
                    "pkIndexId" : "4f18c0b4-7a97-4626-81cd-cd5f1dda401d"
                }, {
                    "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                    "tableName" : "d2w_di_dxflow_execlog_step",
                    "qTableName" : "hmcs_1.d2w_di_dxflow_execlog_step",
                    "objectChname" : "ETL流程输出步骤日志",
                    "objectType" : "tb",
                    "remark" : null,
                    "isPhy" : true,
                    "columns" : [ {
                        "columnId" : "e7825a4a-0069-42c9-bac4-0f23e04501e4",
                        "columnName" : "EXECLOG_ID",
                        "columnChname" : "运行日志ID",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : true,
                        "nk" : false,
                        "fk" : true
                    }, {
                        "columnId" : "98fe1230-dff9-4b3b-9ce5-84d1693069e4",
                        "columnName" : "STEP_ID",
                        "columnChname" : "STEP_ID",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : true,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "bc04f857-61eb-4e3c-8172-b5c207a58903",
                        "columnName" : "STEP_TYPE_GROUP",
                        "columnChname" : "STEP_TYPE_GR",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(60)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "c10f6f5f-872b-432e-bfb1-c40d8a1a3818",
                        "columnName" : "OBJECT_ID",
                        "columnChname" : "数据对象ID",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "4e2e4493-4472-4115-a30a-3c05d64dc13a",
                        "columnName" : "DXFLOW_ID",
                        "columnChname" : "交换流程ID",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "f3b28206-1111-4093-a254-82e8eefb761f",
                        "columnName" : "INPUT_LINES",
                        "columnChname" : "输入记录条数",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "1",
                        "dataTypeFullText" : "DECIMAL(12)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "f60a4479-0b4d-43c3-ad4e-23a27be727fc",
                        "columnName" : "ERROR_LINES",
                        "columnChname" : "错误记录条数",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "1",
                        "dataTypeFullText" : "DECIMAL(12)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "2b866786-d709-4684-a1ee-a4f952bd8521",
                        "columnName" : "INSERT_LINES",
                        "columnChname" : "插入记录条数",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "1",
                        "dataTypeFullText" : "DECIMAL(12)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "e9051ade-7101-4403-82bd-b729fccd24a0",
                        "columnName" : "UPDATE_LINES",
                        "columnChname" : "更新记录条数",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "1",
                        "dataTypeFullText" : "DECIMAL(12)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "8eace85e-017e-4e30-a611-b4fcd104edba",
                        "columnName" : "DELETE_LINES",
                        "columnChname" : "删除记录条数",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "1",
                        "dataTypeFullText" : "DECIMAL(12)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "3bca9ba4-65dc-4168-a2e4-7da6d5b959c4",
                        "columnName" : "OUTPUT_LINES",
                        "columnChname" : "输出记录数",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "1",
                        "dataTypeFullText" : "DECIMAL(12)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "861eb6e0-1aa5-42e1-96f2-70a4165d10b7",
                        "columnName" : "IS_CLEAR_INSERT",
                        "columnChname" : "是否为全新插入",
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    } ],
                    "positionVo" : {
                        "objectId" : "276815af-78e5-4050-8fed-a002209ef01f",
                        "positionX" : 708,
                        "positionY" : 350,
                        "positionWidth" : 0,
                        "positionHeight" : 0,
                        "modelId" : null
                    },
                    "pkIndexId" : "916c9ec0-ad96-4085-bce7-a0f878e9cfe8"
                }, {
                    "objectId" : "9db7440b-54cf-4c83-999b-1017b66e6307",
                    "tableName" : "d2w_di_dxstat_times_byday_one",
                    "qTableName" : "d2w_di_dxstat_times_byday_one",
                    "objectChname" : "交换流程运行次数统计",
                    "objectType" : "tb",
                    "remark" : null,
                    "isPhy" : true,
                    "columns" : [ {
                        "columnId" : "19d2ad2e-c8ad-4b76-9257-ca40aa460d92",
                        "columnName" : "DXFLOW_ID",
                        "columnChname" : "流程ID",
                        "objectId" : "9db7440b-54cf-4c83-999b-1017b66e6307",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "f03d5b3d-59eb-469b-a2ca-e4cfb2e00998",
                        "columnName" : "DAY",
                        "columnChname" : "日期",
                        "objectId" : "9db7440b-54cf-4c83-999b-1017b66e6307",
                        "logicDataType" : "9",
                        "dataTypeFullText" : "DATETIME(19)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "c821be2f-b853-4a52-b496-9d2bb55fbc68",
                        "columnName" : "TIMES_TOTAL",
                        "columnChname" : "总次数",
                        "objectId" : "9db7440b-54cf-4c83-999b-1017b66e6307",
                        "logicDataType" : "1",
                        "dataTypeFullText" : "DECIMAL(8)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "7471289c-74a4-4ab0-9b92-ee210a53cba2",
                        "columnName" : "TIMES_INC",
                        "columnChname" : "增加次数",
                        "objectId" : "9db7440b-54cf-4c83-999b-1017b66e6307",
                        "logicDataType" : "1",
                        "dataTypeFullText" : "DECIMAL(8)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    } ],
                    "positionVo" : {
                        "objectId" : "9db7440b-54cf-4c83-999b-1017b66e6307",
                        "positionX" : 708,
                        "positionY" : 704,
                        "positionWidth" : 0,
                        "positionHeight" : 0,
                        "modelId" : null
                    },
                    "pkIndexId" : null
                }, {
                    "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                    "tableName" : "d2w_res_dataobj_index",
                    "qTableName" : "hmcs_1.d2w_res_dataobj_index",
                    "objectChname" : "数据对象索引",
                    "objectType" : "tb",
                    "remark" : null,
                    "isPhy" : true,
                    "columns" : [ {
                        "columnId" : "1b0af9f6-eab1-483a-bbf0-2e8c0007c1d8",
                        "columnName" : "INDEX_ID",
                        "columnChname" : "索引ID",
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : true,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "e403eb7c-d96f-425d-92b6-341eef3cb625",
                        "columnName" : "PHY_INDEX_NAME",
                        "columnChname" : "物理索引名",
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(127)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "8d9c2958-9623-4a5e-867e-2ce3007ff470",
                        "columnName" : "CN_NAME",
                        "columnChname" : "中文名",
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(127)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "21dbbc03-2003-490f-9585-dddeff3dd2c6",
                        "columnName" : "OBJECT_ID",
                        "columnChname" : "数据对象ID",
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(36)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : true
                    }, {
                        "columnId" : "7ac440fe-b5fe-46a2-bb97-90a6e4138015",
                        "columnName" : "IS_PHY_PK",
                        "columnChname" : "是否为物理主键,一个表为",
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "ad35aab8-9881-4adc-b465-5d9d9d49d7d2",
                        "columnName" : "INDEX_TYPE",
                        "columnChname" : "索引类型：Unique-",
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "cde01eb2-e5f5-4a6a-b563-60ad140a28f1",
                        "columnName" : "IS_PHY_INDEX",
                        "columnChname" : "是否为物理索引",
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "e3d0f0be-6254-46c7-8581-9cd75ff3fcb7",
                        "columnName" : "IS_ORIGINAL",
                        "columnChname" : "是否数据库原已有索引",
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "a0c736c3-f32f-4f9e-8981-85015d7512f2",
                        "columnName" : "INDEX_TABLESPACE",
                        "columnChname" : "索引表空间",
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(127)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "b1434994-78ff-46f2-9083-808affccedda",
                        "columnName" : "INDEX_METHOD",
                        "columnChname" : "索引方法",
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "VARCHAR(30)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    }, {
                        "columnId" : "6d7a84f7-e7ab-42e2-9241-0c2546681ef0",
                        "columnName" : "IS_ENABLE",
                        "columnChname" : "是否启用,数据库里是否启",
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "logicDataType" : "2",
                        "dataTypeFullText" : "CHAR(1)",
                        "value" : null,
                        "pk" : false,
                        "nk" : false,
                        "fk" : false
                    } ],
                    "positionVo" : {
                        "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                        "positionX" : 0,
                        "positionY" : 1058,
                        "positionWidth" : 0,
                        "positionHeight" : 0,
                        "modelId" : null
                    },
                    "pkIndexId" : "04db3414-fc77-4663-a36f-9a5a934984fc"
                } ],
                "fks" : [ {
                    "type":"1",
                    "fkId" : "a4a022eb-ece8-4b63-8758-0e6cba7711f8",
                    "phyFkName" : "FK_D2W_RES_DATAOBJ_FK_R_O",
                    "fkChname" : null,
                    "objectId" : "4d9fa60e-f3a7-499a-9213-ca3722714dd4",
                    "refedObjectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                    "refedObjectQname" : "hmcs_1.d2w_res_dataobj",
                    "isPhy" : true
                }, {
                    "type":"1",
                    "fkId" : "fee171bd-5a17-48ff-af1e-0c31f96bf0e3",
                    "phyFkName" : "FK_D2W_RES_DATAOBJ_INDEX_R_O",
                    "fkChname" : null,
                    "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                    "refedObjectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                    "refedObjectQname" : "hmcs_1.d2w_res_dataobj",
                    "isPhy" : true
                }, {
                    "type":"2",
                    "fkId" : "fee171bd-5a17-48ff-af1e-0c31f96bf0e2",
                    "phyFkName" : "custom",
                    "fkChname" : null,
                    "objectId" : "9c222b38-b47e-4eaf-ac0e-4f3863fc5007",
                    "refedObjectId" : "4d1802bc-a433-4d2c-a1f2-8cfd92fcdc42",
                    "refedObjectQname" : "hmcs_1.d2w_res_dataobj",
                    "isPhy" : true
                } ]
            },
            "count" : 0,
            "iTotalDisplayRecords" : 0,
            "iTotalRecords" : 0,
            "totalPage" : 0,
            "currPage" : 0,
            "nowTime" : null,
            "queryId" : null,
            "table" : null
        };

        window.data = currentData = data;

        var data_list = {'cells': []}; //渲染元素的对象

        var startTime =new Date().getTime();
        $.each(data.object.dataObjects, function (i, v) {

            var this_v = v;  //记录当前表对象
            var objectChname = this_v.objectChname ? this_v.objectChname : this_v.tableName; //表中文名
            var tableName = this_v.tableName?this_v.tableName:this_v.objectChname; //表英文名

            var obj =   {
                "type": "bpmn.Choreography",
                "participants": [
                    objectChname
                ],
                "initiatingParticipant": "Potential Buyer",
                "position": {
                    "x": this_v.positionVo.positionX,
                    "y": this_v.positionVo.positionY
                },
                "angle": 0,
                "id": this_v.objectId,
                "embeds": "",
                "z": 1,
                "qTableName" : this_v.qTableName,
                "subProcess": false,
                "attrs": {
                    ".participant-rect": {
                        "fill": "ff8040"
                    },
                    '.participant-label':{
                        'fill': '#fff'
                    },
                    ".sub-process": {
                        "visibility": "hidden",
                        "data-sub-process": ""
                    },
                    'div': {

                    },
                    '.body' : {

                    },
                    'objectChname': objectChname,
                    'tableName': tableName,
                    'isEnglish': false
                }
            };

            var MaxChart;
            var maxShowNameCharSize = 0;
            var maxDataTypeCharSize = 0;
            var maxFeatureCharSize = 0;

            var fieldsArr = [];
            $.each(this_v.columns, function (i, v) {   //遍历字段信息
                var columnShowname =  v.columnChname ? v.columnChname: v.columnName;
                var columnNameEnglish = v.columnName?v.columnName:v.columnChname;
                var columnDataTypeFullText = v.dataTypeFullText;
                var columnFeature = "[";
                if (v.pk){
                    columnFeature = columnFeature + "PK,";
                }
                if (v.fk){
                    columnFeature = columnFeature + "FK,";
                }
                if (v.nk){
                    columnFeature = columnFeature + "NK,";
                }

                if (columnFeature.charAt(columnFeature.length-1) == ','){
                    columnFeature = columnFeature.substring(0, columnFeature.length -1) + "]";
                }
                else {
                    columnFeature = "";
                }

                var showNameCharSize = len(columnShowname) *7;
                var dataTypeCharSize = len(columnDataTypeFullText) *7;
                var featureCharSize = len(columnFeature) *7;

                if (showNameCharSize > maxShowNameCharSize)  maxShowNameCharSize = showNameCharSize;
                if (dataTypeCharSize > maxDataTypeCharSize)  maxDataTypeCharSize = dataTypeCharSize;
                if (featureCharSize > maxFeatureCharSize)  maxFeatureCharSize = featureCharSize;



                var pfields = '<tr><td class="fieldsTd columnName" data-columnName="' + columnNameEnglish + '" data-columnChname="' +columnShowname+ '">' + columnShowname + '</td><td class="fieldsTd">'+columnDataTypeFullText+'</td><td class="fieldsTd">'+columnFeature+'</td></tr>';
                fieldsArr.push(pfields);   //每行添加到元素中
            })

            MaxChart = maxShowNameCharSize + maxDataTypeCharSize + maxFeatureCharSize;

            obj.attrs.div.html =  '<table>'+fieldsArr.join("")+'</table>';  //字段信息全部加载到元素中
            obj.size = {  //元素的大小
                "width": ((this_v.positionVo.positionWidth && rawType !='fm') ? this_v.positionVo.positionWidth : MaxChart + 100),
                "height": ((this_v.positionVo.positionHeight && rawType !='fm') ? this_v.positionVo.positionHeight : (30 + (this_v.columns.length>5?5:this_v.columns.length) * 25))
            }; //字段宽度的最大值


            data_list.cells.push(obj);      //所有的表对象添加

        });

        var time1 =new Date().getTime();
        console.log("复制表对象耗时:" +  (time1 - startTime));

        $.each(data.object.fks, function (i, v) {  //遍历线
            var link = {
                "type":"link",
                "source":{"id":v.objectId},
                "target":{"id":v.refedObjectId},
                //  "router":{"name":"manhattan"},
                "connector":{"name":"rounded"},
                "id":v.fkId,
                "z":7,
                "vertices":[],
                "attrs":{".connection":{"stroke-width":2,"stroke-dasharray":(v.isPhy?null:"5 2"),"pointerEvents":"none"},
                    ".marker-target":{"d":"M 10 0 L 0 5 L 10 10 z"}}
                ,
                "labels": [
                    {"position": 0.5, "attrs": {"text": {"text": v.fkChname ? v.fkChname : v.phyFkName}}}
                ],
                '.tool-remove' : v.isPhy?null:''

            };
            if(v.type ==="1"){
                link.attrs[".connection"].stroke = "#20C1DD";
                link.attrs[".marker-target"].fill = "#20C1DD";
                link.attrs[".marker-target"].stroke = "#20C1DD";
            }else{
                link.attrs[".connection"].stroke = "#feb663";
                link.attrs[".marker-target"].fill = "#feb663";
                link.attrs[".marker-target"].stroke = "#feb663";
            }


            data_list.cells.push(link); //所有的关系对象添加
        });

        var time2 =new Date().getTime();
        console.log("复制连线对象耗时:" +  (time2 - time1));

        graph.fromJSON(data_list);   //导入json数据

        $(".tool-remove").remove();

        var endTime =new Date().getTime();
        console.log("渲染ER图耗时:" +  (endTime - time2));
        console.log("加载ER图总耗时:" +  (endTime - startTime));

    }*/

})();
